package com.ctgu.ImageRecognition.controller;

import com.ctgu.ImageRecognition.entity.Tag;
import com.ctgu.ImageRecognition.service.TagService;
import com.ctgu.ImageRecognition.util.ResultUtil;
import com.ctgu.ImageRecognition.vo.ResultVO;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (Tag)表控制层
 *
 * @author 
 * @since 2023-07-05 18:31:03
 */
@RestController
@RequestMapping("/tag")
public class TagController {
    /**
     * 服务对象
     */
    @Resource
    private TagService tagService;



    /**
    * Description:展示所有标签
    * @author: 吴杰
    * @date: 2023/7/13 14:40
    * @param:
     * * @return:
    */
    @RequestMapping("/listTag")
    public ResultVO listTag(){
        return ResultUtil.success("获取数据成功",tagService.listTags());
    }

    /**
    * Description:展示所有标签和第一张照片
    * @author: 吴杰
    * @date: 2023/7/17 15:13
    * @param:
     * * @return:
    */
    @RequestMapping("/TagPhoto")
    public ResultVO listTagPhoto(){
        return ResultUtil.success("数据获取成功",tagService.listTagAndPhoto());
    }

    @RequestMapping("/testTag")
    public Tag testTag(){
        if(tagService.testTag()==null) System.out.println("输出为null");
        System.out.println("tagService = " + tagService.testTag());
        return tagService.testTag();
    }
}

